<script setup>
import { ref, onMounted, onUnmounted } from "vue";
import {
  getMyResume,
  getDictionary,
  saveJobSeekStatus,
} from "../../../api/resume.js";
import cacheManager from "../../../utils/cache.js";

// 简历数据
const resumeData = ref({
  id: "", // 简历ID字段
  name: "",
  age: "",
  location: "",
  education: "",
  phone: "",
  sex: "", // 性别字段
  avatar: "/static/images/avatar.png",
  status: "",
  advantage: "",
  advantageHtml: "",
  credentials: "",
  graduationYear: "", // 毕业年份
  birthday: "", // 生日
  workExpectList: [],
  projectExpList: [],
  educationList: [],
  workExpList: [],
});
// 缓存键名和过期时间（毫秒）
const CACHE_KEY = "job_seek_status";
const JOB_EXPECTATION_CACHE_KEY = "job_expectation";
const CACHE_EXPIRY = 24 * 60 * 60 * 1000; // 24小时
// 求职状态字典数据
const jobSeekStatusList = ref([]);
// 当前选中的求职状态索引
const selectedStatusIndex = ref(0);
// 资格证书和专业技能列表
const credentialsList = ref([]);
const skillsList = ref([]);

// 格式化日期
const formatDate = (dateString) => {
  if (!dateString) return "";
  return dateString.replace(/-/g, ".");
};

// 性别映射函数
const getSexText = (sex) => {
  switch (sex) {
    case 1:
      return "男";
    case 2:
      return "女";
    case 3:
      return "保密";
    default:
      return "未知";
  }
};

// 计算年龄
const calculateAge = (birthday) => {
  if (!birthday) return 0;
  
  const birthDate = new Date(birthday);
  const today = new Date();
  
  let age = today.getFullYear() - birthDate.getFullYear();
  const monthDiff = today.getMonth() - birthDate.getMonth();
  
  // 如果当前月份小于生日月份，或者当前月份等于生日月份但当前日期小于生日日期，则年龄减1
  if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {
    age--;
  }
  
  return age > 0 ? age : 0;
};

// 判断毕业年份类型
const getGraduationStatus = (graduationYear) => {
  if (!graduationYear) return "";
  
  const currentYear = new Date().getFullYear();
  const currentMonth = new Date().getMonth() + 1; // JavaScript月份从0开始
  
  // 如果是当前年份，需要根据月份判断
  if (graduationYear === currentYear) {
    // 假设毕业季是6月，6月之前算应届生，6月之后算往届生
    return currentMonth < 6 ? "应届生" : "往届生";
  }
  
  // 如果毕业年份大于当前年份，是应届生
  if (graduationYear > currentYear) {
    return "应届生";
  }
  
  // 如果毕业年份小于当前年份，是往届生
  return "往届生";
};

// 获取最新学历
const getLatestEducation = (educationList) => {
  if (!educationList || educationList.length === 0) return "";
  
  // 按照结束日期排序，获取最新的教育经历
  const sortedEducation = [...educationList].sort((a, b) => {
    // 处理"至今"的情况
    const endDateA = a.endDate === "至今" ? "9999-12" : a.endDate;
    const endDateB = b.endDate === "至今" ? "9999-12" : b.endDate;
    
    const dateA = new Date(endDateA.replace(/-/g, '/'));
    const dateB = new Date(endDateB.replace(/-/g, '/'));
    return dateB - dateA;
  });
  
  console.log("教育经历排序后:", sortedEducation);
  return sortedEducation[0]?.education || "";
};

// 获取简历数据
const fetchResumeData = async () => {
  try {
    console.log("开始获取简历数据...");
    const data = await getMyResume();
    console.log("获取简历数据成功:", data);

    if (data) {
      // 更新简历数据 - 映射API返回的字段
      resumeData.value.id = data.id || ""; // 简历ID字段
      resumeData.value.name = data.nickName || ""; // 姓名字段
      resumeData.value.phone = data.phone || ""; // 电话字段
      resumeData.value.avatar = data.face || "/static/images/avatar.png"; // 头像字段
      resumeData.value.sex = getSexText(data.sex); // 性别字段
      resumeData.value.graduationYear = data.graduationYear || ""; // 毕业年份
      resumeData.value.birthday = data.birthday || ""; // 生日
      resumeData.value.age = calculateAge(data.birthday); // 计算年龄
      resumeData.value.education = getLatestEducation(data.educationList || []); // 获取最新学历
      
      // 调试日志
      console.log("毕业年份:", data.graduationYear);
      console.log("生日:", data.birthday);
      console.log("计算的年龄:", resumeData.value.age);
      console.log("学历:", resumeData.value.education);
      console.log("毕业状态:", getGraduationStatus(data.graduationYear));
      resumeData.value.status = data.status || "";
      resumeData.value.advantage = data.advantage || "";
      resumeData.value.advantageHtml = data.advantageHtml || "";
      resumeData.value.credentials = data.credentials || "";
      resumeData.value.workExpectList = data.workExpectList || [];
      resumeData.value.projectExpList = data.projectExpList || [];
      resumeData.value.educationList = data.educationList || [];
      resumeData.value.workExpList = data.workExpList || [];

      // 处理资格证书和专业技能 - 将逗号分隔的字符串转换为数组
      credentialsList.value = data.credentials 
        ? data.credentials.split(',').filter(item => item.trim())
        : [];
      skillsList.value = data.skills 
        ? data.skills.split(',').filter(item => item.trim())
        : [];

      console.log("简历数据更新完成:", resumeData.value);
      console.log("资格证书:", credentialsList.value);
      console.log("专业技能:", skillsList.value);

      // 获取求职状态字典数据
      await fetchJobSeekStatus();
    }
  } catch (error) {
    console.log("获取简历数据失败:", error);
    uni.showToast({
      title: "获取简历数据失败",
      icon: "none",
    });
  }
};

// 获取求职状态字典数据
const fetchJobSeekStatus = async () => {
  try {
    const cacheData = getCachedDictionary("job_seek_status");
    if (cacheData && Array.isArray(cacheData)) {
      jobSeekStatusList.value = cacheData;
    } else {
      const data = await getDictionary("job_seek_status");
      jobSeekStatusList.value = data;
      setCachedDictionary(data);
    }

    if (resumeData.value.status) {
      const currentIndex = jobSeekStatusList.value.findIndex(
        (item) => item.value === resumeData.value.status
      );
      selectedStatusIndex.value = currentIndex >= 0 ? currentIndex : 0;
    }
  } catch (error) {
    console.log("获取求职状态字典数据失败:", error);
  }
};
// 获取缓存的字典数据
const getCachedDictionary = () => {
  try {
    return cacheManager.get(CACHE_KEY);
  } catch (e) {
    console.error("获取缓存字典数据失败:", e);
  }
  return null;
};

// 设置字典数据缓存
const setCachedDictionary = (data) => {
  try {
    cacheManager.set(CACHE_KEY, data, CACHE_EXPIRY);
  } catch (e) {
    console.error("设置缓存字典数据失败:", e);
  }
};
// 处理求职状态选择变化
const onStatusChange = async (e) => {
  const index = e.detail.value;
  selectedStatusIndex.value = index;
  const newStatus = jobSeekStatusList.value[index].value;
  resumeData.value.status = newStatus;

  try {
    // 保存到服务器
    await saveJobSeekStatus(newStatus);
    console.log("求职状态已更新并保存:", newStatus);
    uni.showToast({
      title: "求职状态已更新",
      icon: "success",
    });
  } catch (error) {
    console.log("保存求职状态失败:", error);
    uni.showToast({
      title: "保存失败，请重试",
      icon: "none",
    });
    // 恢复之前的状态
    resumeData.value.status =
      jobSeekStatusList.value[selectedStatusIndex.value].value;
  }
};

// 返回上一页
const goBack = () => {
  uni.navigateBack();
};

// 跳转到简历预览页面
const goToPreview = () => {
  uni.navigateTo({
    url: '/pages/candidate/resume/resumePreview'
  });
};

// 编辑方法
const editSection = (section) => {
  console.log("编辑", section);
  if (section === "name") {
    // 跳转到个人信息编辑页面
    uni.navigateTo({
      url: "/pages/candidate/editProfile",
    });
  }
};

// 处理个人优势显示（字数限制和换行处理）
const getDisplayAdvantage = (advantage) => {
  if (!advantage) return "";
  
  // 移除HTML标签获取纯文本
  const plainText = advantage.replace(/<[^>]*>/g, "");
  
  // 将\n转换为实际换行
  const lines = plainText.split('\n');
  
  // 最多显示两行
  const displayLines = lines.slice(0, 2);
  
  // 每行最多显示50个字符
  const limitedLines = displayLines.map(line => {
    if (line.length > 50) {
      return line.substring(0, 50) + "...";
    }
    return line;
  });
  
  // 如果原始内容超过两行，在最后添加省略号
  if (lines.length > 2) {
    const lastLine = limitedLines[limitedLines.length - 1];
    if (!lastLine.endsWith("...")) {
      limitedLines[limitedLines.length - 1] = lastLine + "...";
    }
  }
  
  return limitedLines.join('\n');
};

// 编辑个人优势
const editAdvantage = () => {
  uni.navigateTo({
    url: `/pages/candidate/resume/advantageEdit?advantage=${encodeURIComponent(
      resumeData.value.advantage || ""
    )}&advantageHtml=${encodeURIComponent(
      resumeData.value.advantageHtml || ""
    )}`,
  });
};

// 编辑工作经历
const editWorkExperience = (work) => {
  console.log("编辑工作经历:", work);
  // 跳转到编辑工作经历页面，传递工作经历数据和简历ID
  uni.navigateTo({
    url: `/pages/candidate/resume/addWorkExperience?resumeId=${encodeURIComponent(
      resumeData.value.id || ""
    )}&id=${encodeURIComponent(work.id || "")}`,
  });
};

// 编辑项目经历
const editProjectExperience = (project) => {
  console.log("编辑项目经历:", project);
  // 跳转到编辑项目经历页面，传递项目经历数据和简历ID
  uni.navigateTo({
    url: `/pages/candidate/resume/addProjectExperience?resumeId=${encodeURIComponent(
      resumeData.value.id || ""
    )}&id=${encodeURIComponent(project.id || "")}`,
  });
};

// 编辑教育经历
const editEducation = (education) => {
  console.log("编辑教育经历:", education);
  // 跳转到编辑教育经历页面，传递教育经历数据和简历ID
  uni.navigateTo({
    url: `/pages/candidate/resume/addEducation?resumeId=${encodeURIComponent(
      resumeData.value.id || ""
    )}&id=${encodeURIComponent(education.id || "")}`,
  });
};

// 编辑求职期望
const editWorkExpectation = (expectation) => {
  console.log("编辑求职期望:", expectation);
  // 跳转到编辑求职期望页面，传递求职期望数据和简历ID
  uni.navigateTo({
    url: `/pages/candidate/resume/addWorkExpectation?resumeId=${encodeURIComponent(
      resumeData.value.id || ""
    )}&id=${encodeURIComponent(expectation.id || "")}`,
  });
};

// 页面显示时刷新数据
const onShow = () => {
  console.log("页面显示，重新获取数据");
  fetchResumeData();
};

// 添加方法
const addSection = (section) => {
  console.log("添加", section);
  if (section === "workExpectList") {
    // 跳转到添加求职期望页面，传递简历ID
    uni.navigateTo({
      url: `/pages/candidate/resume/addWorkExpectation?resumeId=${encodeURIComponent(
        resumeData.value.id || ""
      )}`,
    });
  } else if (section === "workExpList") {
    // 跳转到添加工作经历页面，传递简历ID
    uni.navigateTo({
      url: `/pages/candidate/resume/addWorkExperience?resumeId=${encodeURIComponent(
        resumeData.value.id || ""
      )}`,
    });
  } else if (section === "projectExpList") {
    // 跳转到添加项目经历页面，传递简历ID
    uni.navigateTo({
      url: `/pages/candidate/resume/addProjectExperience?resumeId=${encodeURIComponent(
        resumeData.value.id || ""
      )}`,
    });
  } else if (section === "educationList") {
    // 跳转到添加教育经历页面，传递简历ID
    uni.navigateTo({
      url: `/pages/candidate/resume/addEducation?resumeId=${encodeURIComponent(
        resumeData.value.id || ""
      )}`,
    });
  }
};

// 查看详情
const viewDetails = (section) => {
  console.log("查看详情", section);
};

// 添加资格证书
const addCredentials = () => {
  console.log("添加资格证书");
  uni.navigateTo({
    url: `/pages/candidate/resume/credentialsSkills?type=credentials&value=${encodeURIComponent(
      credentialsList.value.join(',')
    )}`,
  });
};

// 添加专业技能
const addSkills = () => {
  console.log("添加专业技能");
  uni.navigateTo({
    url: `/pages/candidate/resume/credentialsSkills?type=skills&value=${encodeURIComponent(
      skillsList.value.join(',')
    )}`,
  });
};

// 页面加载时获取数据
onMounted(() => {
  console.log("页面加载，开始获取数据");
  fetchResumeData();

  // 监听简历刷新事件
  uni.$on("refreshResume", () => {
    console.log("收到简历刷新事件，重新获取数据");
    fetchResumeData();
  });
});

// 页面卸载时清理事件监听器
onUnmounted(() => {
  uni.$off("refreshResume");
});

// 暴露生命周期函数给 uni-app
defineExpose({
  onShow,
});
</script>

<template>
  <view class="resume-container">
    <!-- 页头 -->
    <view class="header">
      <view class="header-content">
        <view class="back-btn" @click="goBack">
          <image
            class="back-icon"
            src="/static/icons/candidate/pre_page.png"
          ></image>
        </view>
        <text class="header-title">我的简历</text>
        <view class="header-right">
          <text class="preview-btn" @click="goToPreview">预览</text>
        </view>
      </view>
    </view>

    <!-- 个人信息 -->
    <view class="personal-info">
      <view class="info-left">
        <view class="name-section">
          <text class="name">{{ resumeData.name || "未填写姓名" }}</text>
          <image
            class="edit-icon"
            src="/static/icons/edit-black.png"
            @click="editSection('name')"
          ></image>
        </view>
        <view class="basic-info">
          <!-- 毕业年份和应届生/往届生状态 -->
          <text v-if="resumeData.graduationYear">{{ resumeData.graduationYear }}{{ getGraduationStatus(resumeData.graduationYear) }}</text>
          
          <!-- 年龄前的分隔符 -->
          <text class="dot" v-if="resumeData.graduationYear && resumeData.age && resumeData.age > 0">·</text>
          
          <!-- 年龄 -->
          <text v-if="resumeData.age && resumeData.age > 0">{{ resumeData.age }}岁</text>
          
          <!-- 学历前的分隔符 -->
          <text class="dot" v-if="(resumeData.graduationYear || (resumeData.age && resumeData.age > 0)) && resumeData.education">·</text>
          
          <!-- 学历 -->
          <text v-if="resumeData.education">{{ resumeData.education }}</text>
        </view>
        <view class="contact-info">
          <view class="contact-item" v-if="resumeData.phone">
            <image class="icon" src="/static/icons/candidate/phone.png" style="margin-top: 3rpx;"></image>
            <text class="contact-text">{{ resumeData.phone }}</text>
          </view>
        </view>
      </view>
      <view class="avatar-section">
        <image
          class="avatar"
          :src="resumeData.avatar"
          mode="aspectFill"
        ></image>
      </view>
    </view>

    <!-- 分割线 -->
    <view class="divider"></view>

    <!-- 求职状态 -->
    <uni-section title="求职状态" >
      <uni-list>
        <uni-list-item
          v-if="jobSeekStatusList.length === 0"
          showArrow
          clickable
        >
          <template v-slot:body>
            <view class="section-content">
              <text class="empty-text">暂无求职状态</text>
            </view>
          </template>
        </uni-list-item>
        <uni-list-item v-else showArrow clickable>
          <template v-slot:body>
            <view class="section-content">
              <picker
                :value="selectedStatusIndex"
                :range="jobSeekStatusList"
                range-key="value"
                @change="onStatusChange"
                class="status-picker"
              >
                <view class="picker-content">
                  <text class="status-text">{{
                    resumeData.status || "请选择求职状态"
                  }}</text>
                </view>
              </picker>
            </view>
          </template>
        </uni-list-item>
      </uni-list>
    </uni-section>

    <!-- 个人优势 -->
    <uni-section title="个人优势">
      <template v-slot:right>
        <image
          class="section-icon"
          src="/static/icons/candidate/edit-4.png"
          @click="editAdvantage"
        ></image>
      </template>
      <uni-list>
        <uni-list-item
          v-if="!resumeData.advantage"
          showArrow
          clickable
          @click="editAdvantage"
        >
          <template v-slot:body>
            <view class="section-content">
              <text class="empty-text">暂无个人优势</text>
            </view>
          </template>
        </uni-list-item>
        <uni-list-item v-else showArrow clickable @click="editAdvantage">
          <template v-slot:body>
            <view class="section-content">
              <text class="advantage-text">{{ getDisplayAdvantage(resumeData.advantage) }}</text>
            </view>
          </template>
        </uni-list-item>
      </uni-list>
    </uni-section>

    <!-- 求职期望 -->
    <uni-section title="求职期望">
      <template v-slot:right>
        <image
          class="section-icon"
          src="/static/icons/candidate/add.png"
          @click="addSection('workExpectList')"
        ></image>
      </template>
      <uni-list>
        <uni-list-item v-if="resumeData.workExpectList.length === 0">
          <template v-slot:body>
            <view class="section-content">
              <text class="empty-text">暂无求职期望</text>
            </view>
          </template>
        </uni-list-item>
        <uni-list-item
          v-for="(expectation, index) in resumeData.workExpectList"
          :key="index"
          showArrow
          clickable
          @click="editWorkExpectation(expectation)"
        >
          <template v-slot:body>
            <view class="job-expectation-item">
              <view class="expectation-main">
                <text class="position">{{ expectation.jobName }}</text>
                <text class="salary"
                  >{{ expectation.beginSalary }}-{{
                    expectation.endSalary
                  }}K</text
                >
              </view>
              <view class="expectation-location">
                <text class="city">{{ expectation.city }}</text>
                <text class="separator">|</text>
                <text class="industry">{{ expectation.industry }}</text>
              </view>
            </view>
          </template>
        </uni-list-item>
      </uni-list>
    </uni-section>

    <!-- 工作经历 -->
    <uni-section title="工作经历">
      <template v-slot:right>
        <image
          class="section-icon"
          src="/static/icons/candidate/add.png"
          @click="addSection('workExpList')"
        ></image>
      </template>
      <uni-list>
        <uni-list-item v-if="resumeData.workExpList.length === 0">
          <template v-slot:body>
            <view class="section-content">
              <text class="empty-text">暂无工作经历</text>
            </view>
          </template>
        </uni-list-item>
        <uni-list-item
          v-for="(work, index) in resumeData.workExpList"
          :key="index"
          showArrow
          clickable
          @click="editWorkExperience(work)"
        >
          <template v-slot:body>
            <view class="work-item">
              <view class="work-header">
                <text class="company-name">{{ work.companyName }}</text>
                <text class="work-period"
                  >{{ formatDate(work.beginDate) }}-{{
                    formatDate(work.endDate)
                  }}</text
                >
              </view>
              <view class="work-position">
                <text>岗位: {{ work.position }}</text>
              </view>
              <view class="work-content">
                <text class="content-text"
                  >内容:
                  {{
                    work.content && work.content.length > 20
                      ? work.content.substring(0, 20) + "..."
                      : work.content || "暂无工作内容"
                  }}</text
                >
              </view>
            </view>
          </template>
        </uni-list-item>
      </uni-list>
    </uni-section>

    <!-- 项目经历 -->
    <uni-section title="项目经历">
      <template v-slot:right>
        <image
          class="section-icon"
          src="/static/icons/candidate/add.png"
          @click="addSection('projectExpList')"
        ></image>
      </template>
      <uni-list>
        <uni-list-item v-if="resumeData.projectExpList.length === 0">
          <template v-slot:body>
            <view class="section-content">
              <text class="empty-text">暂无项目经历</text>
            </view>
          </template>
        </uni-list-item>
        <uni-list-item
          v-for="(project, index) in resumeData.projectExpList"
          :key="index"
          showArrow
          clickable
          @click="editProjectExperience(project)"
        >
          <template v-slot:body>
            <view class="project-item">
              <view class="project-header">
                <text class="project-name">{{ project.projectName }}</text>
                <text class="project-period"
                  >{{ formatDate(project.beginDate) }}-{{
                    formatDate(project.endDate)
                  }}</text
                >
              </view>
              <view class="project-role">
               <text>职责: {{ project.roleName }}</text>
              </view>
              <view class="project-description">
                <text class="desc-content"
                  >内容:
                  {{
                    project.content && project.content.length > 20
                      ? project.content.substring(0, 20) + "..."
                      : project.content || "暂无描述"
                  }}</text
                >
              </view>
            </view>
          </template>
        </uni-list-item>
      </uni-list>
    </uni-section>

    <!-- 教育经历 -->
    <uni-section title="教育经历" type="line">
      <template v-slot:right>
        <image
          class="section-icon"
          src="/static/icons/candidate/add.png"
          @click="addSection('educationList')"
        ></image>
      </template>
      <uni-list>
        <uni-list-item v-if="resumeData.educationList.length === 0">
          <template v-slot:body>
            <view class="section-content">
              <text class="empty-text">暂无教育经历</text>
            </view>
          </template>
        </uni-list-item>
        <uni-list-item
          v-for="(education, index) in resumeData.educationList"
          :key="index"
          showArrow
          clickable
          @click="editEducation(education)"
        >
          <template v-slot:body>
            <view class="education-item">
              <view class="education-header">
                <view class="education-info">
                  <text class="school-name">{{ education.school }}</text>
                  <view class="degree-major">
                    <text class="education-degree">{{
                      education.education
                    }}</text>
                    <text class="dot">·</text>
                    <text class="education-major">{{ education.major }}</text>
                  </view>
                </view>
                <text class="education-period"
                  >{{ formatDate(education.beginDate) }}-{{
                    formatDate(education.endDate)
                  }}</text
                >
              </view>
            </view>
          </template>
        </uni-list-item>
      </uni-list>
    </uni-section>

    <!-- 资格证书 -->
    <uni-section title="资格证书" type="line">
      <template v-slot:right>
        <image
          class="section-icon"
          src="/static/icons/candidate/add.png"
          @click="addCredentials"
        ></image>
      </template>
      <uni-list>
        <uni-list-item v-if="credentialsList.length === 0">
          <template v-slot:body>
            <view class="section-content">
              <text class="empty-text">暂无资格证书</text>
            </view>
          </template>
        </uni-list-item>
        <uni-list-item v-else showArrow clickable @click="addCredentials">
          <template v-slot:body>
            <view class="section-content">
              <view class="tags-container">
                <view
                  class="credentials-tag"
                  v-for="(credential, index) in credentialsList"
                  :key="index"
                >
                  <text class="tag-text">{{ credential }}</text>
                </view>
              </view>
            </view>
          </template>
        </uni-list-item>
      </uni-list>
    </uni-section>

    <!-- 专业技能 -->
    <uni-section title="专业技能" type="line">
      <template v-slot:right>
        <image
          class="section-icon"
          src="/static/icons/candidate/add.png"
          @click="addSkills"
        ></image>
      </template>
      <uni-list>
        <uni-list-item v-if="skillsList.length === 0">
          <template v-slot:body>
            <view class="section-content">
              <text class="empty-text">暂无专业技能</text>
            </view>
          </template>
        </uni-list-item>
        <uni-list-item v-else showArrow clickable @click="addSkills">
          <template v-slot:body>
            <view class="section-content">
              <view class="tags-container">
                <view
                  class="skills-tag"
                  v-for="(skill, index) in skillsList"
                  :key="index"
                >
                  <text class="tag-text">{{ skill }}</text>
                </view>
              </view>
            </view>
          </template>
        </uni-list-item>
      </uni-list>
    </uni-section>
  </view>
</template>

<style scoped lang="less">
.resume-container {
  background-color: #ffffff;
  min-height: 100vh;
  padding: 0 20rpx;
}

/* 页头样式 */
.header {
  background-color: #ffffff;
  border-bottom: 1px solid #f0f0f0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20rpx 30rpx;
  height: 88rpx;
}

.back-btn {
  width: 60rpx;
  height: 60rpx;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-icon {
  width: 48rpx;
  height: 48rpx;
}

.header-title {
  font-size: 36rpx;
  font-weight: 500;
  color: #333;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

.header-right {
  min-width: 80rpx;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-btn {
  font-size: 32rpx;
  color: #00bdb4;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

/* 分割线 */
.divider {
  height: 1px;
  background-color: #f0f0f0;
}

/* 个人信息 */
.personal-info {
  padding: 40rpx 30rpx;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20rpx;
}

.info-left {
  flex: 1;
}

.name-section {
  display: flex;
  align-items: center;
  margin-bottom: 20rpx;
}

.name {
  font-size: 50rpx;
  font-weight: 600;
  color: #1a1a1a;
  margin-right: 20rpx;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0.5px;
}

.edit-icon {
  width: 28rpx;
  height: 28rpx;
  opacity: 0.7;
  cursor: pointer;
}

.basic-info {
  font-size: 28rpx;
  color: #999;
  margin-bottom: 20rpx;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
}

.dot {
  margin: 0 10rpx;
}

.contact-info {
  display: flex;
  flex-direction: row;
  gap: 30rpx;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 15rpx;
}

.icon {
  width: 26rpx;
  height: 26rpx;
}

.contact-text {
  font-size: 28rpx;
  color: #999999bd;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
}

.avatar-section {
  margin-left: 40rpx;
}

.avatar {
  width: 150rpx;
  height: 150rpx;
  border-radius: 60rpx;
}

/* uni-section 和 uni-list 样式 */
.uni-section {
  margin-bottom: 20rpx;
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 20rpx;
}

/* 最后一个section不需要分割线 */
.uni-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* 让section标题加粗加大 */
:deep(.uni-section__content-title) {
  font-weight: 700 !important;
  font-size: 40rpx !important;
  color: #1a1a1a !important;
  padding-left: 10rpx !important;
}

:deep(.uni-section__content-title-text) {
  font-weight: 700 !important;
  font-size: 40rpx !important;
  color: #1a1a1a !important;
}

/* section右侧图标样式 */
.section-icon {
  width: 40rpx;
  height: 40rpx;
  cursor: pointer;
}

/* 个人信息中的编辑图标样式 */
.edit-icon {
  width: 28rpx;
  height: 28rpx;
  opacity: 0.7;
  cursor: pointer;
}

:deep(.uni-list--border-top) {
  display: none !important;
}

:deep(.uni-list--border-bottom) {
  display: none !important;
}

:deep(.uni-border-top-bottom) {
  border: none !important;
}

:deep(.uni-list-item) {
  border: none !important;
  border-top: none !important;
  border-bottom: none !important;
}

// .uni-list-item {
// //   padding: 10rpx 10rpx;
//   min-height: 80rpx;
// }

.section-content {
  color: #333;
  font-size: 32rpx;
  line-height: 1.5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  min-height: 40rpx;
  display: flex;
  align-items: center;
}

.advantage-text {
  white-space: pre-line; /* 保留换行符 */
  line-height: 1.5;
  max-height: 96rpx; /* 限制最大高度为两行，适配32rpx字体 */
  overflow: hidden;
  word-break: break-word;
}

.empty-text {
  color: #999;
  font-style: italic;
  min-height: 40rpx;
  display: flex;
  align-items: center;
}

.project-item {
  margin-bottom: 30rpx;
  padding: 25rpx 0;
  min-height: 80rpx;
  width: 100%;
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20rpx;
}

.project-name {
  font-weight: 600;
  color: #1a1a1a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 35rpx;
}

.project-period {
  color: #666;
  font-size: 30rpx;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
}

.project-role {
  display: flex;
  align-items: center;
  margin-bottom: 15rpx;
}

.role-label {
  font-size: 28rpx;
  color: #666;
  margin-right: 15rpx;
  font-weight: 500;
}

.role-content {
  font-size: 28rpx;
  color: #333;
  font-weight: 400;
}

.project-description {
  display: flex;
  align-items: flex-start;
  margin-bottom: 15rpx;
}

.desc-label {
  font-size: 28rpx;
  color: #666;
  margin-right: 15rpx;
  font-weight: 500;
  white-space: nowrap;
}

.desc-content {
  font-size: 28rpx;
  color: #333;
  font-weight: 400;
  line-height: 1.4;
  flex: 1;
}

.project-achievement {
  display: flex;
  align-items: flex-start;
}

.achievement-label {
  font-size: 28rpx;
  color: #666;
  margin-right: 15rpx;
  font-weight: 500;
  white-space: nowrap;
}

.achievement-content {
  font-size: 28rpx;
  color: #333;
  font-weight: 400;
  line-height: 1.4;
  flex: 1;
}

/* 工作经历样式 */
.work-item {
  margin-bottom: 30rpx;
  padding: 25rpx 0;
  min-height: 80rpx;
  width: 100%;
}

.work-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20rpx;
  width: 100%;
  display: flex;
  justify-content: space-between;
}

.company-name {
  font-weight: 600;
  color: #1a1a1a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 35rpx;
}

.work-period {
  color: #666;
  font-size: 30rpx;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
}

.work-position {
  display: flex;
  align-items: center;
  gap: 15rpx;
  margin-bottom: 15rpx;
}

.position-content {
  font-size: 28rpx;
  color: #333;
  font-weight: 500;
}

.department-info {
  font-size: 28rpx;
  color: #666;
  font-weight: 400;
}

.work-industry {
  display: flex;
  align-items: center;
  margin-bottom: 15rpx;
}

.industry-content {
  font-size: 28rpx;
  color: #666;
  font-weight: 400;
}

.work-content {
  display: flex;
  align-items: flex-start;
}

.content-text {
  font-size: 28rpx;
  color: #333;
  font-weight: 400;
  line-height: 1.4;
  flex: 1;
}

.education-item {
  margin-bottom: 25rpx;
  min-height: 60rpx;
  width: 100%;
}

.education-header {
  display: flex;
  align-items: center;
  gap: 20rpx;
}

.school-logo {
  width: 80rpx;
  height: 80rpx;
  background-color: #007aff;
  border-radius: 40rpx;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 40rpx;
  flex-shrink: 0;
}

.education-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8rpx;
}

.school-name {
  font-weight: 600;
  color: #1a1a1a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 32rpx;
  margin-bottom: 0;
}

.degree-major {
  display: flex;
  align-items: center;
  gap: 10rpx;
}

.education-degree,
.education-major {
  color: #666;
  font-size: 28rpx;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
}

.education-period {
  color: #666;
  font-size: 28rpx;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  flex-shrink: 0;
}

.education-courses {
  margin: 15rpx 0;
  padding: 10rpx 0;
  display: flex;
  align-items: flex-start;
}

.courses-label {
  font-size: 28rpx;
  color: #666;
  margin-right: 15rpx;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.courses-content {
  font-size: 28rpx;
  color: #333;
  font-weight: 400;
  line-height: 1.4;
  flex: 1;
}

.education-details {
  display: flex;
  flex-direction: column;
  gap: 12rpx;
}

.detail-item {
  padding: 8rpx 0;
  display: flex;
  align-items: flex-start;
}

.detail-label {
  font-size: 28rpx;
  color: #666;
  margin-right: 15rpx;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.detail-content {
  font-size: 28rpx;
  color: #666;
  font-weight: 400;
  line-height: 1.4;
  flex: 1;
}

.honor-item,
.skill-item {
  margin-bottom: 20rpx;
  min-height: 40rpx;
  display: flex;
  align-items: center;
}

/* 求职期望样式 */
.job-expectation-item {
  padding: 20rpx 0;
  min-height: 80rpx;
}

.expectation-main {
  display: flex;
  align-items: center;
  gap: 20rpx;
  margin-bottom: 15rpx;
}

.position {
  font-size: 35rpx;
  font-weight: 600;
  color: #1a1a1a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

.salary {
  font-size: 35rpx;
  font-weight: 600;
  color: #1a1a1a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

.expectation-detail {
  margin-bottom: 10rpx;
}

.position-type {
  font-size: 28rpx;
  color: #999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
}

.expectation-location {
  display: flex;
  align-items: center;
  gap: 10rpx;
}

.city,
.industry {
  font-size: 28rpx;
  color: #999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
}

.separator {
  font-size: 28rpx;
  color: #999;
  font-weight: 400;
}

/* 所获荣誉样式 */
.honors-container {
  display: flex;
  flex-wrap: wrap;
  gap: 15rpx;
  padding: 15rpx 0;
  min-height: 40rpx;
}

.honor-tag {
  background-color: #f5f5f5;
  border-radius: 20rpx;
  padding: 8rpx 16rpx;
  display: inline-flex;
  align-items: center;
}

.honor-tag text {
  font-size: 20rpx;
  color: #666;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  line-height: 1.4;
}

/* 资格证书样式 */
.certificates-container {
  display: flex;
  flex-wrap: wrap;
  gap: 15rpx;
  padding: 15rpx 0;
  min-height: 40rpx;
}

.certificate-tag {
  background-color: #f5f5f5;
  border-radius: 20rpx;
  padding: 8rpx 16rpx;
  display: inline-flex;
  align-items: center;
}

.certificate-tag text {
  font-size: 20rpx;
  color: #666;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  line-height: 1.4;
}

/* 专业技能样式 */
.skill-content {
  color: #333;
  font-size: 28rpx;
  line-height: 1.6;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  min-height: 40rpx;
  display: flex;
  align-items: flex-start;
  padding-left: 30rpx;
  text-align: justify;
}

:deep(.uni-list--border) {
  display: none !important;
}

/* 求职状态选择弹出层样式 */
.status-popup {
  background-color: #ffffff;
  border-radius: 20rpx 20rpx 0 0;
  padding: 40rpx 30rpx;
  min-height: 400rpx;
}

.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40rpx;
  padding-bottom: 20rpx;
  border-bottom: 1px solid #f0f0f0;
}

.popup-title {
  font-size: 36rpx;
  font-weight: 600;
  color: #1a1a1a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

.popup-actions {
  display: flex;
  gap: 30rpx;
}

.cancel-btn {
  font-size: 32rpx;
  color: #999;
  font-weight: 400;
  cursor: pointer;
}

.confirm-btn {
  font-size: 32rpx;
  color: #00bdb4;
  font-weight: 500;
  cursor: pointer;
}

.status-picker {
  width: 100%;
}

.picker-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 30rpx 20rpx;
  background-color: #f8f9fa;
  border-radius: 12rpx;
  border: 1px solid #e9ecef;
}

.picker-text {
  font-size: 32rpx;
  color: #333;
  font-weight: 400;
}

.picker-arrow {
  font-size: 24rpx;
  color: #999;
  font-weight: 400;
}

/* 求职状态选择器样式 */
.status-picker {
  width: 100%;
}

.picker-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  min-height: 40rpx;
}

.status-text {
  font-size: 32rpx;
  color: #333;
  font-weight: 400;
  line-height: 1.5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

.picker-arrow {
  width: 32rpx;
  height: 32rpx;
  opacity: 0.6;
}

/* 资格证书和专业技能标签样式 */
.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 20rpx;
  padding: 15rpx 0;
  min-height: 40rpx;
}

.credentials-tag,
.skills-tag {
  background-color: #46b4b3;
  border-radius: 30rpx;
  padding: 12rpx 24rpx;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.credentials-tag .tag-text,
.skills-tag .tag-text {
  font-size: 26rpx;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  line-height: 1.2;
  white-space: nowrap;
}
</style>